/* eslint-disable*/

export function methodRecursionTest() {
    //console.log(obj.sayHello(3));
    //console.log(testFn(3));
    console.log(testFn2(3));
}

let obj = {
    sayHello: function (n) {
        return n > 1 ? obj.sayHello(n-1) + '-hello':'hello';
    }
}

let objEnhance = {
    sayHello: function (n) {
        return n > 1 ? this.sayHello(n-1) + '-hello':'hello';
    }
}

const obj1 = {sayHello:obj.sayHello}

const testFn = function (n) {
    obj = {};
    return obj1.sayHello(3);
}

const testFn2 = function (n) {
    objEnhance = {};
    const obj2 = {sayHello:objEnhance.sayHello}

    return obj2.sayHello(n);
}